<script setup>
// 感统界面
import VanillaTilt from "vanilla-tilt";
import { ref, onMounted } from "vue";
import { useRouter } from "vue-router";

const router = useRouter();

const goFrontHome = () => {
  router.push({ path: "/frontHome" });
};

const dialogABC = ref(false);
const openDialog = () => {
  dialogABC.value = true;
};

onMounted(() => {
  // vanilla-tilt.js是一个平滑的3D倾斜JS库，具体参数配置度娘可查到
  VanillaTilt.init(document.querySelectorAll(".card"), {
    max: 15, //最大倾斜度数
    speed: 400, //倾斜转换的速度
    glare: true, //是否开启眩光效果
    "max-glare": 1, //最大眩光的不透明度
  });

  VanillaTilt.init(document.querySelectorAll(".card"));
});
</script>

<template>
  <div class="body">
    <div class="heard">
      <h1>感统</h1>
    </div>

    <div class="container" >
      <div class="card" @click="openDialog()">
        <div class="content">
          <h2>01</h2>
          <h3>听觉</h3>
        </div>
      </div>
      <div class="card">
        <div class="content">
          <h2>01</h2>
          <h3>前庭</h3>
        </div>
      </div>
      <div class="card">
        <div class="content">
          <h2>01</h2>
          <h3>本体</h3>
        </div>
      </div>
      <div class="card">
        <div class="content">
          <h2>01</h2>
          <h3>触觉</h3>
        </div>
      </div>
      <div class="card">
        <div class="content">
          <h2>01</h2>
          <h3>视觉</h3>
        </div>
      </div>
      
    </div>

    <div>
      <el-dialog :lock-scroll="false"  v-model="dialogABC" title="小星宝" width="800">
        1555555
    </el-dialog>
    </div>
  </div>
</template>


<style scoped>
/* 引入网络字体：Poppins */
@import url("http://fonts.googleapis.com/css?family=Poppins:200,300,400,500,600,700,800,900&display=swap");
* {
  /* 初始化 */
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  /* 设置字体 */
  font-family: "Poppins";
}
.body {
  /* 100%窗口高度 */
  min-height: 100vh;
  /* 弹性布局 水平+垂直居中 */
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: rgb(86, 56, 106);
  
}

.heard {
  position: absolute;
  top: 15%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1; /*确保 .heard 处于最上层 */
}
.heard h1 {
  font-size: 80px;
  color: #fff;
}

.container {
  /* border: 1px solid red; */
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  /* justify-content: center;
  align-items: center; */
  flex-wrap: wrap;
  z-index: 1;
}
.container .card {
  /* 相对定位 */
  position: relative;
  width: 280px;
  height: 200px;
  /* background-color: rgba(255, 255, 255, 0.1); */
  background-color: rgb(83, 116, 64);
  margin: 30px;
  border-radius: 15px;
  /* 阴影 */
  box-shadow: 20px 20px 50px rgba(0, 0, 0, 0.5);
  /* 溢出隐藏 */
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  border-top: 1px solid rgba(255, 255, 255, 0.5);
  border-left: 1px solid rgba(255, 255, 255, 0.5);
  /* 背景模糊 */
  backdrop-filter: blur(5px);
}
.container .card .content {
  padding: 20px;
  text-align: center;
  /* 默认下移+隐藏 */
  /* transform: translateY(100px); */
  /* opacity: 0; */
  transition: 0.5s;
}
.container .card:hover .content {
  /* 鼠标移入，上移+显示 */
  transform: translateY(0);
  opacity: 1;
}
.container .card .content h2 {
  position: absolute;
  top: -80px;
  right: 25px;
  font-size: 128px;
  color: rgba(255, 255, 255, 0.05);
}
.container .card .content h3 {
  font-size: 28px;
  color: #fff;
}

.container .card .content a {
  position: relative;
  display: inline-block;
  padding: 8px 20px;
  margin-top: 15px;
  background-color: #fff;
  color: #000;
  text-decoration: none;
  border-radius: 20px;
  font-weight: 500;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}
</style>